<template>
  <div class="result-page">
    <div class="ms_box">
      <h1 class="rt_tle">五行八字列表</h1>
      <div class="result_box">
        <x-table class="name_des_1">
          <tbody>
            <tr>
              <td>八字</td>
              <td colspan="3">
                <span
                  v-for="bzs in result.bz"
                  class="tb_sp"
                >
                  {{bzs}}
                </span>
              </td>
            </tr>
            <tr>
              <td>五行</td>
              <td colspan="3">
                <span
                  v-for="wxs in result.wx"
                  class="tb_sp"
                >
                  {{wxs}}
                </span>
              </td>
            </tr>
            <tr>
              <td>五行分析</td>
              <td colspan="3">{{ result.describe }}</td>
            </tr>
          </tbody>
        </x-table>
        <wx-leida ref="wx_ld" />
      </div>
    </div>
    <loading
      :show="loading_show"
      text="加载中..."
    ></loading>
  </div>
</template>

<script>
import WxLeida from "../componments/echart/wx_leida.vue";
import { XTable, Loading } from "vux";
import g from "../common/js/http.js";
export default {
  components: {
    XTable,
    WxLeida,
    Loading
  },
  data() {
    return {
      result: "",
      wx_arr: "",
      loading_show: false,
      date_s: "",
      time_s: ""
    };
  },
  created() {
    this.date_s = this.$route.query.date_s;
    this.time_s = this.$route.query.time_s;
    this.getData();
  },
  filters: {
    sexChange(val) {
      if (val == "1") {
        return "男";
      } else {
        return "女";
      }
    },
    replace_str(val) {
      return val.replace("<br>", "");
    }
  },
  methods: {
    getData() {
      var req_data = {
        date_s: this.date_s,
        time_s: this.time_s
      };
      this.loading_show = true;
      var _this = this;
      g.post_func("/api/v1/bz_wx", req_data, function(data) {
        _this.result = data.data;
        _this.loading_show = false;
        _this.$refs.wx_ld.show_chart(_this.result.wx_arr);
        _this.loading_show = false;
      });
    },
    replace_word() {
      var _this = this;
      this.result.name_arr.forEach(element => {
        element.mean.forEach(v => {
          v.mean.replace(v.hz, '<font style="color:red">' + v.hz + "</font>");
        });
      });
    }
  }
};
</script>
<style scoped>
.wx_mean {
  height: 200px;
  overflow-y: auto;
  display: block;
  text-align: left;
}
.tb_tle td {
  font-weight: 600;
}
.btn_detial {
  display: block;
  height: 32px;
  width: 100px;
  margin: 0 auto;
  line-height: 32px;
  color: #fff;
  background: #fbb03b;
  border: 2px solid #fbb03b;
  text-align: center;
  cursor: pointer;
  border-radius: 4px;
}
.fl_left {
  display: block;
  float: left;
}
.fl_right {
  display: block;
  float: right;
}
.ft_bd {
  font-weight: 600;
}
.fl_cen {
  line-height: 75pt;
  font-size: 16pt;
}
.name_word_bg {
  background-image: url("../../static/icon/bg_s3.png");
  background-size: 100%;
  padding: 10px;
  background-repeat: no-repeat;
}
.tb_sp {
  background: #eee;
  margin-left: 2.5px;
  color: #333;
  padding: 5px;
}
.result_box {
  border: 1px solid #2c2121;
  background-color: #fff;
  width: 95%;
  padding: 3px;
  margin: 20px auto;
}
.rt_tle {
  font-size: 14pt;
  font-weight: 600;
  border-left: 5px solid #e3434f;
  text-align: left;
  margin: 15px 0;
  padding-left: 5px;
}
.score {
  font-size: 30pt;
  color: red;
  line-height: 70pt;
}
.bg_s2 {
  background-image: url("../../static/icon/bg_s2.png");
  background-size: 100%;
}
</style>